<template>
	<view class="root-wrap">
		<view v-if="isLogin&&status=='nopass'" class="fail-reason">
			<view class="title">审核未通过原因：</view>
			<view class="desc">{{userInfo.check_remark}}</view>
		</view>
		<view class="require">
			<view class="wrap-title">必填信息<text class="desc">（只有通过审核才能对项目报价）</text></view>
			<view class="content-wrap" @click="navTo('/pages/my/info/base')">
				<view class="item-title">企业基本信息</view>
				<view class="right">
					<text v-if="status=='nocheck'" class="status">{{userInfo.status_text}}</text>
					<text v-if="status=='checking'" class="status">{{userInfo.status_text}}</text>
					<text v-if="status=='nopass'" class="status fail">{{userInfo.status_text}}</text>
					<text v-if="status=='normal'" class="status success">{{userInfo.status_text}}</text>
					<u-icon name="arrow-right" color="#C0C4CC" size="32rpx"></u-icon>
				</view>
			</view>
		</view>
		<view class="more-wrap">
			<view class="wrap-title">补充信息</view>
			<view class="content-wrap">
				<view class="item" @click="navTo('/pages/my/info/bank')">
					<view class="item-title">银行信息</view>
					<u-icon name="arrow-right" color="#C0C4CC" size="32rpx"></u-icon>
				</view>
				<view class="item" @click="navTo('/pages/my/info/invoice')">
					<view class="item-title">发票信息</view>
					<u-icon name="arrow-right" color="#C0C4CC" size="32rpx"></u-icon>
				</view>
				<view class="item" @click="navTo('/pages/my/info/link')">
					<view class="item-title">联系人信息</view>
					<u-icon name="arrow-right" color="#C0C4CC" size="32rpx"></u-icon>
				</view>
				<view class="item" @click="navTo('/pages/my/info/attach')">
					<view class="item-title">上传证照附件</view>
					<u-icon name="arrow-right" color="#C0C4CC" size="32rpx"></u-icon>
				</view>
				<view class="item" @click="navTo('/pages/my/info/other')">
					<view class="item-title">上传其它资质证书</view>
					<u-icon name="arrow-right" color="#C0C4CC" size="32rpx"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {getUserInfo} from '@/api/user.js';
	export default {
		data() {
			return {
				status: '',
				userInfo: {},
				isLogin: false
			};
		},
		onLoad(){
			this.isLogin = this.vuex_has_login;
			this.userInfo = this.vuex_user;
			this.status = this.userInfo.status;
		},
		onShow(){
			console.log('执行onShow');
			this.getUserInfo();
		},
		methods:{
			getUserInfo(){
				getUserInfo().then((res)=>{
					if (1 == res.code) {
						this.userInfo = res.data;
						this.status = res.data.status;
						this.$u.vuex('vuex_user', res.data)
					} else {
						uni.showToast({
							title:res.msg,
							icon:'none'
						})
					}
				})
			},
			navTo(url){
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss">
.root-wrap{
	width: 702rpx;
	margin: 0 24rpx;
	.fail-reason{
		margin-top: 50rpx;
		.title{
			font-weight: 500;
			font-size: 32rpx;
			color: #E75618;
			line-height: 56rpx
		}
		.desc{
			font-weight: 400;
			font-size: 28rpx;
			color: #E75618;
			line-height: 50rpx;
			margin-top: 8rpx;
		}
	}
	.wrap-title{
		font-weight: 500;
		font-size: 32rpx;
		color: #000000;
		line-height: 56rpx;
		margin-bottom: 22rpx;
		margin-top: 58rpx;
		.desc{
			font-weight: 400;
		}
	}
	.item-title{
		position: relative;
		font-weight: 500;
		font-size: 32rpx;
		color: #303133;
		line-height: 56rpx;
		padding-left: 12rpx;
	}
	.item-title::after{
		content: '';
		position: absolute;
		left: 0;
		top: 14rpx;
		width: 4rpx;
		height: 32rpx;
		background-color: #30D6C2;
	}
	.require{
		.content-wrap{
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			align-items: center;
			width: 702rpx;
			height: 120rpx;
			padding: 0 24rpx;
			background-color: #F3F4F6;
			border-radius: 8rpx;
			.right{
				display: flex;
				justify-content: flex-end;
				align-items: center;
				.status{
					font-size: 28rpx;
					color: #E75618;
					margin-right: 12rpx;
				}
				.success{
					color: #30D6C2;
				}
			}
		}
	}
	.more-wrap{
		.content-wrap{
			box-sizing: border-box;
			width: 702rpx;
			background-color: #F3F4F6;
			border-radius: 8rpx;
			.item{
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 24rpx 0;
				margin: 0 24rpx;
				border-bottom: 2rpx solid #DFDFE0;
			}
			.item:last-of-type{
				border-bottom: none;
			}
		}
	}
}
</style>
